package com.zhangpingyang.springcloud.hystrixservice.controller;

import com.zhangpingyang.springcloud.hystrixservice.domain.CommonResult;
import com.zhangpingyang.springcloud.hystrixservice.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: Zhang Pingyang
 * @Date: 2019/11/27 17:33
 */
@RestController
@RequestMapping("")
public class UserHystrixController {

    @Autowired
    private UserService userService;

    @GetMapping(value = "testFallback/{id}")
    public CommonResult testFallback(@PathVariable Long id) {
        return userService.getUser(id);
    }

    @GetMapping("testCommand/{id}")
    public CommonResult testCommand(@PathVariable Long id) {
        return userService.getUserCommand(id);

    }

}
